package com.zhome.gateway.enums;

import com.zhome.gateway.constants.Constants;
import com.zhome.gateway.filter.post.ResponseWrapperFilter;
import com.zhome.gateway.filter.pre.*;
import com.zhome.gateway.filter.route.DubboRoutingFilter;
import com.zhome.gateway.filter.route.HomeHostRoutingFilter;
import com.zhome.gateway.filter.route.NacosRoutingFilter;

/**
 *
 * @author cuiyh9
 * @date 2020/5/9
 */
public enum FilterEnum {

    /**
     *  pre 过滤器
     */
    RequestPreFilterEnum(RequestPreFilter.class, Constants.PRE_KEY, 10),
    MockFilterEnum(MockFilter.class, Constants.PRE_KEY, 20),
    RateLimitFilterEnum(RateLimitFilter.class, Constants.PRE_KEY, 30),
    RequestDecryptFilterEnum(RequestDecryptFilter.class, Constants.PRE_KEY, 40),
    TokenValidateFilterEnum(TokenValidateFilter.class, Constants.PRE_KEY, 50),
    BlackListFilterEnum(BlackListFilter.class, Constants.PRE_KEY, 60),
    WhiteListFilterEnum(WhiteListFilter.class, Constants.PRE_KEY, 70),
    XssListFilterEnum(XssFilter.class, Constants.PRE_KEY, 80),

    /**
     *  route 过滤器
     */
    HomeHostRoutingFilterEnum(HomeHostRoutingFilter.class, Constants.ROUTE_KEY, 100),
    DubboRoutingFilterEnum(DubboRoutingFilter.class, Constants.ROUTE_KEY, 110),
    NacosRoutingFilterEnum(NacosRoutingFilter.class, Constants.ROUTE_KEY, 120),

    /**
     *  post 过滤器
     */
    ResponseWrapperFilterEnum(ResponseWrapperFilter.class, Constants.POST_KEY, 900),;

    private Class zclass;

    private String filterType;

    private int filterOrder;

    FilterEnum(Class zclass, String filterType, int filterOrder) {
        this.zclass = zclass;
        this.filterType = filterType;
        this.filterOrder = filterOrder;
    }


    public int getFilterOrder() {
        return this.filterOrder;
    }
}
